unit Uregistro;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DBCtrls, Mask, ExtCtrls;

type
<<<<<<< .mine
  TFRegistro = class(TForm)
    DBENumEmp: TDBEdit;
    LNumEmp: TLabel;
    LNombre: TLabel;
    LRfc: TLabel;
    LNumPlaza: TLabel;
    LPuesto: TLabel;
    LServicio: TLabel;
    LTurno: TLabel;
    LHorario: TLabel;
    DBERfc: TDBEdit;
    DBENumPlaza: TDBEdit;
    DBLCBPuesto: TDBLookupComboBox;
    DBLCBservicio: TDBLookupComboBox;
    DBLCBTurno: TDBLookupComboBox;
    DBLCBHorario: TDBLookupComboBox;
    BBBuscar: TBitBtn;
    BBAnterior: TBitBtn;
    BBSiguiente: TBitBtn;
    BBNuevo: TBitBtn;
    BBCancelar: TBitBtn;
    BBModificar: TBitBtn;
    BBGuardar: TBitBtn;
    BBSalir: TBitBtn;
    DBEApePat: TDBEdit;
    DBEApeMat: TDBEdit;
    DBENombres: TDBEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure BCancelarClick(Sender: TObject);
    procedure BNuevoClick(Sender: TObject);
    procedure BSalirClick(Sender: TObject);
    procedure BBSiguienteClick(Sender: TObject);
    procedure BBAnteriorClick(Sender: TObject);
    procedure BBNuevoClick(Sender: TObject);
    procedure BBCancelarClick(Sender: TObject);
    procedure BBModificarClick(Sender: TObject);
    procedure BBGuardarClick(Sender: TObject);
    procedure BBSalirClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure VerBotAntSig ();
    procedure AbrirTablas ();
    procedure CerrarTablas ();
    procedure ActivarTablas ();
    procedure DesactivarTablas ();
    procedure SoloLectura ();
    procedure Lectura ();
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BBBuscarClick(Sender: TObject);
    procedure DBENumEmpKeyPress(Sender: TObject; var Key: Char);
    procedure DBENumPlazaKeyPress(Sender: TObject; var Key: Char);
    procedure DBENumEmpChange(Sender: TObject);
    procedure DBENombreEmpChange(Sender: TObject);
    procedure DBERfcChange(Sender: TObject);
    procedure DBENumPlazaChange(Sender: TObject);
    procedure DBLCBPuestoClick(Sender: TObject);
    procedure DBLCBservicioClick(Sender: TObject);
    procedure DBLCBTurnoClick(Sender: TObject);
    procedure DBLCBHorarioClick(Sender: TObject);
    procedure DBERfcKeyPress(Sender: TObject; var Key: Char);
    procedure DBEApePatKeyPress(Sender: TObject; var Key: Char);
    procedure DBEApePatChange(Sender: TObject);
    procedure DBEApeMatChange(Sender: TObject);
    procedure DBENombresChange(Sender: TObject);
=======
  TFRegistro = class(TForm)
    DBENumEmp: TDBEdit;
    LNumEmp: TLabel;
    LNombre: TLabel;
    LRfc: TLabel;
    LNumPlaza: TLabel;
    LPuesto: TLabel;
    LServicio: TLabel;
    LTurno: TLabel;
    LHorario: TLabel;
    DBENombreEmp: TDBEdit;
    DBERfc: TDBEdit;
    DBENumPlaza: TDBEdit;
    DBLCBPuesto: TDBLookupComboBox;
    DBLCBservicio: TDBLookupComboBox;
    DBLCBTurno: TDBLookupComboBox;
    DBLCBHorario: TDBLookupComboBox;
    BBBuscar: TBitBtn;
    BBAnterior: TBitBtn;
    BBSiguiente: TBitBtn;
    BBNuevo: TBitBtn;
    BBCancelar: TBitBtn;
    BBModificar: TBitBtn;
    BBGuardar: TBitBtn;
    BBSalir: TBitBtn;
    procedure BCancelarClick(Sender: TObject);
    procedure BNuevoClick(Sender: TObject);
    procedure BSalirClick(Sender: TObject);
    procedure BBSiguienteClick(Sender: TObject);
    procedure BBAnteriorClick(Sender: TObject);
    procedure BModificarClick(Sender: TObject);
    procedure BBNuevoClick(Sender: TObject);
    procedure BBCancelarClick(Sender: TObject);
    procedure BBModificarClick(Sender: TObject);
    procedure BBGuardarClick(Sender: TObject);
    procedure BBSalirClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure VerBotAntSig ();
    procedure AbrirTablas ();
    procedure CerrarTablas ();
    procedure ActivarTablas ();
    procedure DesactivarTablas ();
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
>>>>>>> .r29
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRegistro: TFRegistro;

implementation

<<<<<<< .mine
uses UDatamodule, UInicio, USuplencias, Ubusqueda;
=======
uses UDatamodule, UInicio, USuplencias;
>>>>>>> .r29

{$R *.dfm}

procedure TFRegistro.BCancelarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Cancel;
end;

procedure TFRegistro.BNuevoClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Active:= True;
   DBENumEmp.SetFocus;
end;

procedure TFRegistro.BSalirClick(Sender: TObject);
begin
   FRegistro.Close;
   DataModule1.TEmpleados.Active:= False;
end;

procedure TFRegistro.BBSiguienteClick(Sender: TObject);
begin
<<<<<<< .mine
   DataModule1.TEmpleados.Next;
   VerBotAntSig();
   BBGuardar.Enabled:=False;
   BBNuevo.Enabled:=True;
   BBModificar.Enabled:=True;
   BBCancelar.Enabled:=False;
=======
   DataModule1.TEmpleados.Next;
   VerBotAntSig();
>>>>>>> .r29
end;

procedure TFRegistro.BBAnteriorClick(Sender: TObject);
begin
<<<<<<< .mine
   DataModule1.TEmpleados.Prior;
   VerBotAntSig();
   BBGuardar.Enabled:=False;
   BBNuevo.Enabled:=True;
   BBModificar.Enabled:=True;
   BBCancelar.Enabled:=False;
=======
   DataModule1.TEmpleados.Prior;
   VerBotAntSig();
>>>>>>> .r29
end;

<<<<<<< .mine
procedure TFRegistro.BBNuevoClick(Sender: TObject);
=======
procedure TFRegistro.BModificarClick(Sender: TObject);
>>>>>>> .r29
begin
   //Lectura ();
   BBModificar.Enabled:=False;
   BBCancelar.Enabled:=True;
   DataModule1.TEmpleados.Append;
   BBAnterior.Enabled:=False;
   BBSiguiente.Enabled:=False;
   DBENumEmp.SetFocus;
end;

procedure TFRegistro.BBCancelarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Cancel;
   BBCancelar.Enabled:=False;
   BBModificar.Enabled:=True;
   BBNuevo.Enabled:=True;
   BBGuardar.Enabled:=False;
   BBAnterior.Enabled:=True;
   BBSiguiente.Enabled:=True;
   //SoloLectura ();
end;

procedure TFRegistro.BBModificarClick(Sender: TObject);
begin
   //Lectura ();
   DataModule1.TEmpleados.Edit;
   BBModificar.Enabled:=False;
   BBCancelar.Enabled:=True;
   BBAnterior.Enabled:=False;
   BBSiguiente.Enabled:=False;
end;

<<<<<<< .mine
procedure TFRegistro.BBGuardarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Post;
   //SoloLectura ();
   BBModificar.Enabled:=True;
   BBNuevo.Enabled:=True;
   BBCancelar.Enabled:=False;
   BBSiguiente.Enabled:=True;
   BBAnterior.Enabled:=True;
   BBGuardar.Enabled:=False;
end;

procedure TFRegistro.BBSalirClick(Sender: TObject);
begin
   DesactivarTablas;
   CerrarTablas;
   Application.Terminate;
end;

procedure TFRegistro.FormActivate(Sender: TObject);
begin
   ActivarTablas;
   AbrirTablas;
   DBENumEmp.SetFocus;
end;

procedure TFRegistro.VerBotAntSig();
begin
   BBAnterior.Enabled:= not DataModule1.TEmpleados.Bof;
   BBSiguiente.Enabled:= not DataModule1.TEmpleados.Eof;
end;

procedure TFRegistro.AbrirTablas ();
begin
   DataModule1.TEmpleados.Open;
   DataModule1.TPuesto.Open;
   DataModule1.TServicio.Open;
   DataModule1.TTurno.Open;
   DataModule1.THorario.Open;
   DataModule1.TSuplencias.Open;
   DataModule1.TCategoria.Open;
   DataModule1.TSubnivel.Open;
end;

procedure TFRegistro.CerrarTablas ();
begin
   DataModule1.TEmpleados.Close;
   DataModule1.TPuesto.Close;
   DataModule1.TServicio.Close;
   DataModule1.TTurno.Close;
   DataModule1.THorario.Close;
   DataModule1.TSuplencias.Close;
   DataModule1.TCategoria.Close;
   DataModule1.TSubnivel.Close;
end;

procedure TFRegistro.ActivarTablas ();
begin
   DataModule1.TEmpleados.Active:=True;
   DataModule1.TPuesto.Active:=True;
   DataModule1.TServicio.Active:=True;
   DataModule1.TTurno.Active:=True;
   DataModule1.THorario.Active:=True;
   DataModule1.TSuplencias.Active:=True;
   DataModule1.TCategoria.Active:=True;
   DataModule1.TSubnivel.Active:=True;
end;

procedure TFRegistro.DesactivarTablas ();
begin
   DataModule1.TEmpleados.Active:=False;
   DataModule1.TPuesto.Active:=False;
   DataModule1.TServicio.Active:=False;
   DataModule1.TTurno.Active:=False;
   DataModule1.THorario.Active:=False;
   DataModule1.TSuplencias.Active:=False;
   DataModule1.TCategoria.Active:=False;
   DataModule1.TSubnivel.Active:=False;
end;

procedure TFRegistro.SoloLectura ();
begin
   DBENumEmp.ReadOnly:=True;
   DBERfc.ReadOnly:=True;
   DBENumPlaza.ReadOnly:=True;
   DBEApePat.ReadOnly:=True;
   DBEApeMat.ReadOnly:=True;
   DBENombres.ReadOnly:=True;
   DBLCBPuesto.ReadOnly:=True;
   DBLCBservicio.ReadOnly:=True;
   DBLCBTurno.ReadOnly:=True;
   DBLCBHorario.ReadOnly:=True;
end;

procedure TFRegistro.Lectura ();
begin
   DBENumEmp.ReadOnly:=False;
   DBERfc.ReadOnly:=False;
   DBENumPlaza.ReadOnly:=False;
   DBEApePat.ReadOnly:=False;
   DBEApeMat.ReadOnly:=False;
   DBENombres.ReadOnly:=False;
   DBLCBPuesto.ReadOnly:=False;
   DBLCBservicio.ReadOnly:=False;
   DBLCBTurno.ReadOnly:=False;
   DBLCBHorario.ReadOnly:=False;
end;

procedure TFRegistro.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   DesactivarTablas;
   CerrarTablas;
end;

procedure TFRegistro.BBBuscarClick(Sender: TObject);
begin
   FBusqueda.showmodal;
end;

procedure TFRegistro.DBENumEmpKeyPress(Sender: TObject; var Key: Char);
begin
   if not (key in ['0'..'9',#8])then key:=#0;
end;

procedure TFRegistro.DBENumPlazaKeyPress(Sender: TObject; var Key: Char);
begin
   if not (key in ['0'..'9',#8])then key:=#0;
end;

procedure TFRegistro.DBENumEmpChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');;
end;

procedure TFRegistro.DBENombreEmpChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBERfcChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBENumPlazaChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBLCBPuestoClick(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBLCBservicioClick(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBLCBTurnoClick(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBLCBHorarioClick(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');
end;

procedure TFRegistro.DBERfcKeyPress(Sender: TObject; var Key: Char);
begin
   while (DBERfc.GetTextLen <4) do  //or (DBERfc.GetTextLen >9)
      begin
         if not (key in ['a'..'z',#8]) and not (key in ['A'..'Z',#8]) then key:=#0;
         Break;
      end;
   if (DBERfc.GetTextLen > 3) and (DBERfc.GetTextLen <10) then      begin
       if not (key in ['0'..'9',#8]) then key:=#0; end ;
  // if (DBERfc.GetTextLen > 10) and (DBERfc.GetTextLen <14)  then
    //  if not (key in ['0'..'9','a'..'z','A'..'Z',#8]) then key:=#0;
end;

procedure TFRegistro.DBEApePatKeyPress(Sender: TObject; var Key: Char);
begin
   if not (key in ['a'..'z','A'..'Z',#8]) then key:=#0;
end;

procedure TFRegistro.DBEApePatChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');;
end;

procedure TFRegistro.DBEApeMatChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');;
end;

procedure TFRegistro.DBENombresChange(Sender: TObject);
begin
   BBGuardar.Enabled:=(DBENumEmp.Text <> '') and (DBEApePat.Text <> '') and (DBEApeMat.Text <> '') and (DBENombres.Text <> '') and (DBERfc.Text <> '') and (DBENumPlaza.Text <> '') and (DBLCBPuesto.Field.Text <> '') and (DBLCBservicio.Field.Text <> '') and (DBLCBTurno.Field.Text <> '') and (DBLCBHorario.Field.Text <> '');;
end;

=======
procedure TFRegistro.BBNuevoClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Append;
   DBENumEmp.SetFocus;
end;

procedure TFRegistro.BBCancelarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Cancel;
end;

procedure TFRegistro.BBModificarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Edit;
end;

procedure TFRegistro.BBGuardarClick(Sender: TObject);
begin
   DataModule1.TEmpleados.Post;
end;

procedure TFRegistro.BBSalirClick(Sender: TObject);
begin
   DesactivarTablas;
   CerrarTablas;
   Application.Terminate;
end;

procedure TFRegistro.FormActivate(Sender: TObject);
begin
   ActivarTablas;
   AbrirTablas;
   DBENumEmp.SetFocus;
  // BBNuevo.Enabled:=False;
   //BBGuardar.Enabled:=False;
   //BBModificar.Enabled:=False;

  // if (DBENumEmp.GetTextLen ) then
    //  BBGuardar.Enabled:=True;
end;

procedure TFRegistro.VerBotAntSig();
begin
   BBAnterior.Enabled:= not DataModule1.TEmpleados.Bof;
   BBSiguiente.Enabled:= not DataModule1.TEmpleados.Eof;
end;

procedure TFRegistro.AbrirTablas ();
begin
   DataModule1.TEmpleados.Open;
   DataModule1.TPuesto.Open;
   DataModule1.TServicio.Open;
   DataModule1.TTurno.Open;
   DataModule1.THorario.Open;
   DataModule1.TSuplencias.Open;
   DataModule1.TCategoria.Open;
end;

procedure TFRegistro.CerrarTablas ();
begin
   DataModule1.TEmpleados.Close;
   DataModule1.TPuesto.Close;
   DataModule1.TServicio.Close;
   DataModule1.TTurno.Close;
   DataModule1.THorario.Close;
   DataModule1.TSuplencias.Close;
   DataModule1.TCategoria.Close;
end;

procedure TFRegistro.ActivarTablas ();
begin
   DataModule1.TEmpleados.Active:=True;
   DataModule1.TPuesto.Active:=True;
   DataModule1.TServicio.Active:=True;
   DataModule1.TTurno.Active:=True;
   DataModule1.THorario.Active:=True;
   DataModule1.TSuplencias.Active:=True;
   DataModule1.TCategoria.Active:=True;
end;

procedure TFRegistro.DesactivarTablas ();
begin
   DataModule1.TEmpleados.Active:=False;
   DataModule1.TPuesto.Active:=False;
   DataModule1.TServicio.Active:=False;
   DataModule1.TTurno.Active:=False;
   DataModule1.THorario.Active:=False;
   DataModule1.TSuplencias.Active:=False;
   DataModule1.TCategoria.Active:=False;
end;

procedure TFRegistro.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   DesactivarTablas;
   CerrarTablas;
end;

>>>>>>> .r29
end.
